﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BaseObj;
public partial class UserControls_CreateNews : BaseControl
{
    #region 属性
    private int isRelease_Id;

    /// <summary>
    /// 是否直接发布，1为发布，0为仅仅创建
    /// </summary>
    public int IsRelease_Id
    {
        get { return isRelease_Id; }
        set { isRelease_Id = value; }
    }

    #endregion
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void butSave_Click(object sender, EventArgs e)
    {
        News news = new News("", this.txtTitle.Text, this.txtSubTitle.Text, "", this.user.UserId, "", this.fckContent.CreateHtml(), this.txtKeyWords.Text, dstNewsDict.GetIntFormatDcit());
        if (news.Insert(isRelease_Id))
        {
            this.Clear();
            Page.Response.Write("<script>alert(\"信息更新成功！\")</script>");
        }
        else
        {
            Page.Response.Write("<script>alert(\"对不起，信息没有更新成功。\r\n请检查数据访问或者联系开发人员。\")</script>");
        }
    }

    public void Clear()
    {
        this.txtKeyWords.Text = "";
        this.txtSubTitle.Text = "";
        this.txtTitle.Text = "";
        this.dstNewsDict.Text = "";
        this.fckContent.Value = "";
        return;
    }
}
